home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************
- * BGetTCLInfo.c
- *
- * SUPERCLASS = CDLOGDirector
- *
- * Dialog class which prompts user for information and then return his input.
- *
- * © copyright 1991, KSS Scientific Consultants.
- *
- ******************************************************************/
-
- #include <CDialogText.h>
- #include <CWindow.h>
- #include <Commands.h>
- #include <string.h>
- #include "BGetTCLInfo.h"
-
- enum // dialog item IDs
- {
- kReturnStr = 2,
- kPrompt
- };
-
- /*******************************************************************
- * IBGetTCLInfo()
- *
- * Initialization method.
- *
- *******************************************************************/
-
- void BGetTCLInfo::IBGetTCLInfo(short DLOGid, CDirectorOwner *aSupervisor)
- {
- CDLOGDirector::IDLOGDirector(DLOGid, aSupervisor);
- }
-
- /**********************************************************************
- * DoCommand()
- *
- * *******************************************************************/
-
- void BGetTCLInfo::DoCommand(long theCommand)
- {
- CDialogText *theText;
- short length;
-
- switch (theCommand)
- {
- case cmdOK:
- theText = (CDialogText*)itsWindow->FindViewByID(kReturnStr);
- length = (**theText->macTE).teLength;
- BlockMove(*(**theText->macTE).hText, fReturnStr, length);
- fReturnStr[length] = '\0';
- EndDialog( cmdOK, TRUE);
- break;
-
- default:
- inherited::DoCommand(theCommand);
- break;
- }
-
- }
-
- /*********************************************************************
- * GetInfo()
- *
- * Entry method.
- *
- *********************************************************************/
-
- void BGetTCLInfo::GetInfo(char *promptPtr, char *returnPtr)
- {
- long theCommand;
- CDialogText *staticItem;
- Str255 tempStr;
-
- strcpy((char*)tempStr, promptPtr);
- CtoPstr((char*)tempStr);
- staticItem = (CDialogText*)itsWindow->FindViewByID(kPrompt);
- staticItem->SetTextString(tempStr);
-
- // show the dialog
- BeginDialog();
-
- theCommand = DoModalDialog(cmdOK);
-
- strcpy(returnPtr, (char*)fReturnStr);
- }
-